<?php
App::uses('AppController', 'Controller');
/**
 * Articles Controller
 *
 * @property Article $Article
 * @property PaginatorComponent $Paginator
 */
class AboutUsController extends AppController {

/**
 * Components
 *
 * @var array
 */
	public $components = array('Paginator');
    var $uses = array('AboutUs');
/**
 * index method
 *
 * @return void
 */
	public function index() 
    {
        $id = 1;
        if (!$this->AboutUs->exists($id)) {
			throw new NotFoundException(__('Invalid aboutus'));
		}
		$options = array('conditions' => array($this->AboutUs->primaryKey => $id));
        $this->set('aboutus', $this->AboutUs->find('first', $options));
	}
    
    /**
     * 
     */
    public function history() 
    {
		$options = array('conditions' => array('AboutUs.' . $this->AboutUs->primaryKey => 2));
		$this->set('aboutus', $this->AboutUs->find('first', $options));
        
		$options = array('conditions' => array('AboutUs.' . $this->AboutUs->primaryKey => array(9,10,11)));
		$this->set('aboutusMore', $this->AboutUs->find('all', $options));
    }
    
    public function detail($id)
    {
        $options = array('conditions' => array('AboutUs.' . $this->AboutUs->primaryKey => $id));
		$this->set('aboutus', $this->AboutUs->find('first', $options));
        
        if($id != 4) {
            $list = array(2,9,10,11);
            foreach($list as $key => $ids) {
                if($ids == $id) {
                    unset($list[$key]);
                    break;
                }
            }
            $options = array('conditions' => array('AboutUs.' . $this->AboutUs->primaryKey => $list));
            $this->set('aboutusMore', $this->AboutUs->find('all', $options));
          
        }
        
        $this->render('history');
    }
}
